<template>
  <div class="main_box" style="padding:10px;">
    <div class="detail_wrap">
      <div class="tit">
        <h2>基础信息</h2>
        <el-button type="success" plain size="small" icon="fa fa-mail-forward" @click="returnList">返回</el-button>
      </div>
      <div class="con">
        <ul>
          <li>
            <label class="label">登录名：</label>
            <span>{{detailData.loginName}}</span>
          </li>
          <li>
            <label class="label">用户名：</label>
            <span>{{detailData.adminName}}</span>
          </li>
          <li>
            <label class="label">手机号：</label>
            <span>{{detailData.phone}}</span>
          </li>
          <!-- <li>
            <label class="label">性别：</label>
            <span v-if="detailData.sex == 1">男</span>
            <span v-if="detailData.sex == 2">女</span>
          </li> -->
          <li>
            <label class="label">所属部门：</label>
            <span>{{detailData.departName}}</span>
          </li>
          <li>
            <label class="label">用户角色：</label>
            <span>{{formatUserRole(detailData.adminRole)}}</span>
          </li>
          <!-- 增加一个地址 -->
          <li>
            <label class="label">详细地址：</label>
            <span>{{detailData.liveAddress}}</span>
          </li>
          <li>
            <label class="label">备注：</label>
            <span>{{detailData.remark}}</span>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import AuthApi from "@/api/system/auth";
import DepartApi from "@/api/system/depart";

export default{
    data(){
        return {
          detailData: [],
          departList: [],
        }
    },
    mounted(){
      this.init();
    },
    methods:{
      init(){
        this.getData();
      },
      getData(){
        AuthApi.getAdminInfo({adminId:this.$route.query.id})
        .then(res => {
          this.detailData = res.data;
        })
      },
      /**
       * 过滤器
       */
      formatUserRole(value){
        if(value == 1){
          return "系统用户";
        }else if(value== 2){
          return "医生用户";
        }else if(value== 3){
          return "医检用户";
        }
      },
      returnList(){
        this.$store.dispatch('delView', this.$route);
        this.$router.push({path: "/sys/userManagement"})
      }
    },
}
</script>
<style lang="scss" src="@/assets/css/views/Detail.scss" scope>
</style>
